package com.hsogoo.study.spring.serviceloader;

import java.util.ServiceLoader;

import org.junit.Test;

/**
 * Created by za-huangsaigang on 2018/9/18.
 */
public class ServiceLoaderTest {

    @Test
    public void testServiceLoader(){
        ServiceLoader<BizService> bizServices  = ServiceLoader.load(BizService.class);
        for(BizService bizService : bizServices){
            bizService.doBiz();
        }

        ServiceLoader<BizHandler> bizHandlers = ServiceLoader.load(BizHandler.class);
        for(BizHandler bizHandler : bizHandlers){
            bizHandler.handleBiz();
        }
    }
}
